import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin: false,
    userName: "notLogin",
    questionnaireStatus: ['待发布', '收集中', '已截止']
  },
  mutations: {
    userLogin(state, userName) {
      state.isLogin = true
      state.userName = userName
    },
    userLogout(state) {
      state.isLogin = false
    },
    /*refreshMyQuestionnaires(state) {
      this.$serve.getQuestionnaire(state.userName)
          .then(res => {
            state.myQuestionnaires = []
            for (let item of res.data.root) {
              state.myQuestionnaires.push(item[0])
            }
          })
    },
    refreshRecycledQuestionnaires(state) {
      this.$serve.getRecycled(state.userName)
          .then(res => {
            state.recycledQuestionnaires = [];
            for (let item of res.data.root) {
              state.recycledQuestionnaires.push(item[0]);
            }
          })
    }*/
  },
  actions: {},
  modules: {}
})